#pragma once
#include <string>
#include "afxcmn.h"
#include "afxwin.h"
#include "cvxImage.h"
#include "GrabList.h"

using std::string;
class CvxArbitraryCapture;

// CVideoGrab dialog

class CVideoGrab : public CDialog
{
	DECLARE_DYNAMIC(CVideoGrab)

public:
	CVideoGrab(CWnd* pParent = NULL);   // standard constructor
	virtual ~CVideoGrab();

	//added

	//
	bool SetVideo(const string &leftVideoFile, const string &rightVideoFile);

// Dialog Data
	enum { IDD = IDD_VIDEO_GRAB };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();
protected:

	// left video capture
	CvxArbitraryCapture *m_leftVideo;
	string m_leftFileName;
	string m_rightFileName;
	// right video capture
	CvxArbitraryCapture *m_rightVideo;
	//added
	unsigned int m_currentFrame;

	//to cut from startFrame to endFrame to a .avi file
	unsigned int m_startFrame;
	unsigned int m_endFrame;
	
public:
	// slider control for left and right video
	CSliderCtrl m_videoSlider;
	CStatic m_leftFrame;
	CStatic m_rightFrame;
protected:
public:
	afx_msg void OnPaint();
	afx_msg void OnNMReleasedcaptureVideoGramSlider(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnBnClickedVideoGrabFirstFrame();
	afx_msg void OnBnClickedVideoGrabBackward();
	afx_msg void OnBnClickedVideoGrabForward();
	afx_msg void OnBnClickedVideoGrabEndFrame();
	afx_msg void OnBnClickedVideoGrabPlayStop();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
protected:
	// play node on or off
	bool m_playMode;
public:
	afx_msg void OnBnClickedVideoGrabGrab();
	afx_msg void OnBnClickedVideoGrabGrablist();
public:
	// point to grab image list
	CGrabList *m_grabList;
	afx_msg void OnBnClickedButtonStartFrame();
	afx_msg void OnBnClickedButtonEndFrame();
	afx_msg void OnBnClickedButtonSaveVideo();
};
